#include "Component.h"

Component::Component(const std::string &name)
	: name(name)
{
}

Component::~Component()
{
}

void Component::add(const CommandPtr &command)
{
	commands.push_back(command);
}
void Component::remove(const CommandPtr &command)
{
	for(unsigned int i = 0; i < commands.size(); i++)
	{
		if(commands[i]->getName() == command->getName())
		{
			commands[i] = commands.back();
			commands.pop_back();
			return;
		}
	}
}

bool Component::hasCommand(const CommandPtr &command)
{
	for(unsigned int i = 0; i < commands.size(); i++)
	{
		if(commands[i]->getName() == command->getName())
			return true;
	}
	return false;
}

